import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },
  {
    path: '/',
    component: Layout,
    name: '基本信息',
    redirect: '/名称',
    role: ['admin', 'user'],
    meta: { title: '1 基本信息', icon: 'table' },
    children: [
      {
            path: '名称',
            name: '名称',
            role: ['admin', 'user'],
            component: () => import('@/views/基本信息/名称/index.vue'),
            meta: { title: '1.1 名称', icon: 'table' },
      },
      {
        path: '联系',
        name: '联系',
        role: ['admin', 'user'],
        component: () => import('@/views/基本信息/联系/index.vue'),
        meta: { title: '1.2 联系', icon: 'table' },
  },
  {
    path: '2019年招生计划',
    name: '2019年招生计划',
    role: ['admin', 'user'],
    component: () => import('@/views/基本信息/2019年招生计划/index.vue'),
    meta: { title: '1.3 2019年招生计划', icon: 'table' },
},
{
  path: '2019年招生方式',
  name: '2019年招生方式',
  role: ['admin', 'user'],
  component: () => import('@/views/基本信息/2019年招生方式/index.vue'),
  meta: { title: '1.4 2019年招生方式', icon: 'table' },
}, {
  path: '2019年9月1日前在校生',
  name: '2019年9月1日前在校生',
  role: ['admin', 'user'],
  component: () => import('@/views/基本信息/2019年9月1日前在校生/index.vue'),
  meta: { title: '1.5 2019年9月1日前在校生', icon: 'table' },
}, {
  path: '机构设置',
  name: '机构设置',
  role: ['admin', 'user'],
  component: () => import('@/views/基本信息/机构设置/index.vue'),
  meta: { title: '1.6 机构设置', icon: 'table' },
}
    ]
  },
  {
    path: '/',
    component: Layout,
    name: '师资队伍',
    role: ['admin', 'user'],
    meta: { title: '师资队伍', icon: 'table' },
    children: [
      {
            path: '校内专任老师',
            name: '校内专任老师',
            role: ['admin', 'user'],
            component: () => import('@/views/师资队伍/校内专任老师/index.vue'),
            meta: { title: '校内专任老师', icon: 'table' },
      }
    ]
  },
  
  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
